﻿$(function () {
    //获取经纬度参数
    var name = decodeURI(ISS.utils.getParameter("name"));
    var lng = ISS.utils.getParameter("lng");
    var lat = ISS.utils.getParameter("lat");
    //定义地图
    map = new BMap.Map("map-boxI", { enableMapClick: false });
    map.enableScrollWheelZoom();  //启用滚轮放大缩
    //右上角，仅包含平移和缩放按钮
    var top_right_navigation_zoom = new BMap.NavigationControl({ anchor: BMAP_ANCHOR_BOTTOM_LEFT, type: BMAP_NAVIGATION_CONTROL_ZOOM });
    //添加默认缩放平移控件
    map.addControl(top_right_navigation_zoom);
    //绑定地理位置中心点
    var point = new BMap.Point(lng, lat);
    map.centerAndZoom(point, 14);

    //#region 添加Marker
    var marker = new BMap.Marker(point);
    map.addOverlay(marker);
    var label = new BMap.Label(name, { offset: new BMap.Size(20, -10) });
    marker.setLabel(label);
    marker.addEventListener("click", clickFunc);
    label.addEventListener("click", clickFunc);
    //#endregion

    //跳转事件
    function clickFunc() {
        var param = "?name=" + name + "&lng=" + lng + "&lat=" + lat;
        var hrefstr = "/Common/website/view/map/IframeForGoto.html" + param;
        window.parent.MapClickJump(hrefstr, param);
    }
})